< previous page page_283 next page >

Page 283
looks embedded in the status bar; and sbrRaised, which produces a raised panel. These three bevel styles are shown in Figure 12.31.
0283-01.jpg
Figure 12.31
You can create flat, inset, or raised panels.
Managing Panels with Code
You have seen how to set the properties of an individual panel, but you also need to know how to add and remove panels. Within the Property Pages, you can simply use the Insert Panel and Remove Panel buttons. However, the status bar also enables you to add and remove panels from code. This task is handled by the three methods of the Panels collection:
AddCreates a new panel for the status bar
RemoveDeletes a specific panel from the status bar
ClearRemoves all the panels of the status bar
note.gif Unlike most other built-in collection types, the Panels collection starts with an index of 1, and the index values run up to the Count property. square.gif

You have seen that the key status and date/time panels handle their tasks automatically. These things are great, but the real power of the status bar is its capability to change the text that appears in the text-style panel(s) as your program is running. These text panels tell the users the actual status of operations in your program.
To update the status of an item in your program, you assign a text string to the Text property of the Panel object, as shown in the following line of code:
StatusBar1.Panels(1).Text = "Viewing record 1 of 10"
You can, of course, set other properties of the panels the same way. You can even set up your entire status bar in code by using the methods of the Panels collection and the properties of the Panel objects. As an example, Listing 12.7 shows how to set up the status bar shown in Figure 12.32. This listing also uses the Count property of the Panels collection, which tells you how many panels are present in the status bar.
Listing 12.7 STATUS.ZIPSetting Up a Status Bar in Code
Private Sub Form_Load()

    With StatusBar1

        'Remove the default panel
        .Panels.Remove 1

        'Add a Text panel at the left
        .Panels.Add 1, "mykey", "This is the status text", sbrText
continues

 
< previous page page_283 next page >